<template>
  <div>
    <h1>班级人名</h1>
    <p>{{$route.params.id}}</p>
    <p>{{item}}</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      students: [
        { id: 1, students: [{ name: "牛名扬" }, { name: "哲书" }] },
        { id: 2, students: [{ name: "侯妃" }, { name: "天庆" }] },
        { id: 3, students: [{ name: "闰土" }, { name: "晏圳" }] }
      ],
      item: {}
    };
  },
  mounted() {
    //   this.students  数组
    // $route.params.id   this.$route.params.id
    this.item = this.students.find(item => {
      return item.id == this.$route.params.id;
    });
    // console.log(this.item);
  },
  watch:{
    
  }
};
</script>

<style>
</style>